package com.app.stick.monitor.service.impl;

import java.util.Date;
import java.util.List;
import com.app.common.enums.DeleteEnum;
import com.app.common.utils.SecurityUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.app.common.utils.DateUtils;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.app.stick.monitor.mapper.BizPatientMonitorInfoMapper;
import com.app.stick.monitor.domain.BizPatientMonitorInfo;
import com.app.stick.monitor.service.IBizPatientMonitorInfoService;

/**
 * 患者监测数据Service业务层处理
 *
 * @author app
 * @date 2023-12-21
 */
@Service
public class BizPatientMonitorInfoServiceImpl extends ServiceImpl<BizPatientMonitorInfoMapper, BizPatientMonitorInfo> implements IBizPatientMonitorInfoService
{
    @Resource
    private BizPatientMonitorInfoMapper bizPatientMonitorInfoMapper;

    /**
     * 查询患者监测数据
     *
     * @param pmiId 患者监测数据主键
     * @return 患者监测数据
     */
    @Override
    public BizPatientMonitorInfo selectBizPatientMonitorInfoByPmiId(String pmiId)
    {
        return bizPatientMonitorInfoMapper.selectById(pmiId);
    }

    /**
     * 查询患者监测数据列表
     *
     * @param bizPatientMonitorInfo 患者监测数据
     * @return 患者监测数据
     */
    @Override
    public List<BizPatientMonitorInfo> selectBizPatientMonitorInfoList(BizPatientMonitorInfo bizPatientMonitorInfo)
    {
        return bizPatientMonitorInfoMapper.selectBizPatientMonitorInfoList(bizPatientMonitorInfo);
    }

    /**
     * 新增患者监测数据
     *
     * @param bizPatientMonitorInfo 患者监测数据
     * @return 结果
     */
    @Override
    public int insertBizPatientMonitorInfo(BizPatientMonitorInfo bizPatientMonitorInfo)
    {
        bizPatientMonitorInfo.setCreateBy(SecurityUtils.getUserId());
        bizPatientMonitorInfo.setCreateTime(DateUtils.getNowDate());
        bizPatientMonitorInfo.setUpdateBy(SecurityUtils.getUserId());
        bizPatientMonitorInfo.setUpdateTime(DateUtils.getNowDate());
        return bizPatientMonitorInfoMapper.insert(bizPatientMonitorInfo);
    }

    /**
     * 修改患者监测数据
     *
     * @param bizPatientMonitorInfo 患者监测数据
     * @return 结果
     */
    @Override
    public int updateBizPatientMonitorInfo(BizPatientMonitorInfo bizPatientMonitorInfo)
    {
        bizPatientMonitorInfo.setUpdateBy(SecurityUtils.getUserId());
        bizPatientMonitorInfo.setUpdateTime(DateUtils.getNowDate());
        return bizPatientMonitorInfoMapper.updateBizPatientMonitorInfo(bizPatientMonitorInfo);
    }

    /**
     * 删除患者监测数据信息
     *
     * @param pmiId 患者监测数据主键
     * @return 结果
     */
    @Override
    public int deleteBizPatientMonitorInfoByPmiId(Long pmiId)
    {
        BizPatientMonitorInfo bizPatientMonitorInfo = new BizPatientMonitorInfo();
        bizPatientMonitorInfo.setPmiId(pmiId);
        bizPatientMonitorInfo.setDelFlag(DeleteEnum.YES.getCode());
        bizPatientMonitorInfo.setUpdateBy(SecurityUtils.getUserId());
        bizPatientMonitorInfo.setUpdateTime(new Date());
        return bizPatientMonitorInfoMapper.updateById(bizPatientMonitorInfo);
    }
}
